package com.shrct.businessprocess.budget.impl

import com.shrct.businessprocess.budget.BudgetTypeManager
import org.springframework.beans.factory.annotation.Autowired
import com.shrct.businessprocess.budget.BudgetTypeProvider
import java.util.List
import org.springframework.stereotype.Service

@Service("BudgetTypeManager")
class BudgetTypeManagerImpl implements BudgetTypeManager {
	
	@Autowired
	List<BudgetTypeProvider> budgetTypeProviders = newArrayList

	override getAllBudgetTypes() {
		budgetTypeProviders.map[it.registeredBudgetTypes].flatten.toList
	}
	

	override getBudgetType(String typeid) {
		allBudgetTypes.filter[it.typeid == typeid].findFirst[true]
	}
	
}